{# src/Pyaf/GymBundle/Resources/views/AdminAlumno/edit.html.twig #}
{% extends "PyafGymBundle::layout_admin.html.twig" %}
{% block title %} Pyaf {% endblock %}

{% block tituloSector %}<i class="icon-group"></i> Alumnos - Administrar Alumnos{% endblock %}
{% block nombreSector %} Alumnos / Administrar / Agregar nuevo alumno{% endblock %}
{% block dashboardContent %}{% endblock %}

{% block content %}
    <div class="container-fluid" id="content-area" style="padding-right: 30px;">  
        
        {% if app.session.hasFlash('alertaAdminAlumnosSuccess') %}
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaAdminAlumnosSuccess') }}
            </div>
        {% endif %}
        {% if app.session.hasFlash('alertaAdminAlumnosError') %}
            <div class="alert alert-error">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ app.session.flash('alertaAdminAlumnosError') }}
            </div>
        {% endif %}
        
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-head"><i class="icon-table"></i><span>Tablero de Alumnos</span></div>
                <div class="box-body">
                    <div class="span6 offset3">
                        <div class="mini-layout">
                            <div class="mini-layout-header">
                                <i class="icon-leaf"></i>
                                <span>Alumno</span>
                            </div>
                            <div class="mini-layout-body" id="box-info-profesor">  
                                <form name="formulario" id="formulario" action="{{ path('admin_alumnos_edit', {'id': alumno.id}) }}" method="post" class='form-horizontal form-bordered form-validate' {{ form_enctype(formulario) }}>                        
                                {{ form_errors(formulario) }}
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Nombre</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.nombre) }} 
                                            {{ form_errors(formulario.persona.nombre) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Apellido</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.apellido) }} 
                                            {{ form_errors(formulario.persona.apellido) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">DNI</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.dni,{ 'attr': {'readonly': 'true', 'name':'dni'} }) }} 
                                            {{ form_errors(formulario.persona.dni) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Fecha de Nacimiento</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.fecha_nacimiento) }} 
                                            {{ form_errors(formulario.persona.fecha_nacimiento) }}
                                                formato dd/mm/aaaa
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Teléfono</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.telefono, {'attr': {'placeholder':'4xxxxxx (sin característica)', 'maxlength':'7' } }) }} 
                                            {{ form_errors(formulario.persona.telefono) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Celular</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.celular, {'attr': {'placeholder':'343xxxxxxx (sin 0 ni 15)', 'maxlength':'10' } }) }} 
                                            {{ form_errors(formulario.persona.celular) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Dirección</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.direccion) }} 
                                            {{ form_errors(formulario.persona.direccion) }} 
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="emailfield" class="control-label" style="text-align: center;">Email</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.email) }}    
                                            {{ form_errors(formulario.persona.email) }}    
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Patologías</label>
                                        <div class="controls">
                                            {{ form_widget(formulario.persona.anexo) }} 
                                            {{ form_errors(formulario.persona.anexo) }} 
                                        </div>
                                    </div>       
                                    <div class="control-group">
                                        <label for="textfield" class="control-label" style="text-align: center;">Promoción</label>
                                        <div class="controls">                                                               
                                            {{ form_widget(formulario.promocion) }}    
                                            {{ form_errors(formulario.promocion) }} 
                                        </div>
                                    </div>             
                                    <div class="control-group">
                                        <label for="pwfield" class="control-label" style="text-align: center;">Cuota</label>
                                        <div class="controls">
                                            <div class="input-append input-prepend">
                                                <span class="add-on">$</span>
                                                {{ form_widget(formulario.cuota, { 'attr': {'class': 'input-small', 'placeholder': '000'} }) }}    
                                                {{ form_errors(formulario.cuota) }} 
                                                <span class="add-on">.00</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label for="policy" class="control-label" style="text-align: center;">Habilitación</label>
                                        <div class="controls">
                                            <label class="checkbox">
                                                {{ form_widget(formulario.persona.habilitado, 
                                                { 'attr': {'disabled':'disabled' } }) }}   
                                                {{ form_errors(formulario.persona.habilitado) }} 
                                            </label>    
                                        </div>
                                    </div>
                                    {{ form_rest(formulario) }}
                                    <div class="form-actions">
                                            <input type="submit" class="button button-basic-blue" value="Aceptar">
                                            <a href="{{ path('admin_alumnos_list') }}" class="button button-basic">Cancelar</a>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
{% block javascripts %} 
    <script src="{{ asset('bootstrap/js/flick/jquery-1.9.1.js') }}"></script>
    <script src="{{ asset('bootstrap/js/jquery.validate.min.js') }}"></script>
    <script src="{{ asset('bootstrap/js/validacionRegistros.js') }}"></script>    
    <script type="text/javascript">
        $(document).ready(function(){
            
            validarFormularioAlumno($('#formulario'), "{{ path('admin_alumnos_validateUser') }}", true);
            
        });
    </script>
{% endblock %}
